package cn.wolfcode.wolf2world.web.controller;

import cn.wolfcode.wolf2world.domain.Banner;
import cn.wolfcode.wolf2world.service.BannerService;
import cn.wolfcode.wolf2world.service.StrategyService;
import cn.wolfcode.wolf2world.service.TravelService;
import cn.wolfcode.wolf2world.vo.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 杨兴健
 * @Date 2020/8/19 18:32
 */
@RestController
@RequestMapping("/index")
public class IndexController {

    @Autowired
    private BannerService bannerServicep;

    @RequestMapping("/banners/travel")
    public Object bannersTravel() {
        List<Banner> list = bannerServicep.findByType(Banner.TYPE_TRAVEL);
        return JsonResult.success(list);
    }

    @RequestMapping("/banners/strategy")
    public Object bannersStrategy() {
        List<Banner> list = bannerServicep.findByType(Banner.TYPE_STRATEGY);
        return JsonResult.success(list.get(0));
    }


}
